<div style="float:right; width:400px; position:relative">
        	<?php
				$i=0;
				$incomePri[0]=0;
				$outcomePri[0]=0;
				$benifitPri[0]=0;
				$monthPri[0]=0;
				$monthPris=array('Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Des');
				$result=array($resultsPri1,$resultsPri2,$resultsPri3,$resultsPri4,$resultsPri5,$resultsPri6,$resultsPri7,$resultsPri8,$resultsPri9,$resultsPri10,$resultsPri11,$resultsPri12);
				for($j=0;$j<count($result);$j++){
					if($result[$j]->num_rows()>0){
						foreach($result[$j]->result() as $rows){
							$incomePri[$i]=$rows->income==''?0:$rows->income;
							$outcomePri[$i]=$rows->outcome==''?0:$rows->outcome;
							$benifitPri[$i]=$rows->benifit==''?0:$rows->benifit;
							$monthPri[$i]=$rows->month==''?0:$rows->month;
							$i++;
						}
					}else{
						echo "No";	
					}
				}
			?>
        </div>   
<script type="text/javascript">
$(function () {
			//array_reverse($array);
    var income = [];
    var outcome = [];
    var benifit = [];
    var month = [];
	var myTicks=[];
	<?php
		$i=0;
		foreach($incomePri as $row){
		?>
			income.push([<?php echo $i+1;?>,<?php echo $row ?>]);
	<?php
		$i++;
		}
	if($i<5){
	?>
	
	<?php
	}
		$i=0;
		foreach($outcomePri as $row){
	?>
			outcome.push([<?php echo $i+1;?>,<?php echo $row ?>]);
	<?php
		$i++;
		}
	if($i<5){
	?>

	<?php
	}
		$i=0;
		foreach($benifitPri as $row){
	?>
			benifit.push([<?php echo $i+1;?>,<?php echo $row ?>]);
	<?php
		$i++;
		}
	if($i<5){
	?>
	<?php
	}
	?>
	$.plot($("#privateMonthly"), [
        {
			label: "Income",
            data: income,
            lines: { show: true },
			points: {show: true}
			
        },
		{
			label: "Payment",
            data: outcome,
            lines: { show: true },
			points: {show: true}
        },
		{
			label: "Credit",
            data: benifit,
            lines: { show: true },
			points: {show: true}
        }
    ],
	{
		grid: { hoverable: true, clickable: true },
		xaxis: {
			ticks: [
				[1, 'Jan'],
				[2, 'Feb'],
				[3, 'Mar'],
				[4, 'Apr'],
				[5, 'May'],
				[6, 'Jun'],
				[7, 'Jul'],
				[8, 'Aug'],
				[9, 'Sep'],
				[10, 'Oct'],
				[11, 'Nov'],
				[12, 'Des']
			]
		}
	}
	);
	function showTooltip(x, y, contents) {
        $('<div id="tooltip">' + contents + '</div>').css( {
            position: 'absolute',
            display: 'none',
            top: y + 5,
            left: x + 5,
            border: '1px solid #fdd',
            padding: '2px',
            'background-color': '#fee',
            opacity: 0.80
        }).appendTo("body").fadeIn(200);
    }
	var previousPoint = null;
    $("#privateMonthly").bind("plothover", function (event, pos, item) {
		var myMonth=[];
		myMonth.push('Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Des');
        $("#x").text(pos.x.toFixed(2));
        $("#y").text(pos.y.toFixed(2));
            if (item) {
                if (previousPoint != item.dataIndex) {
                    previousPoint = item.dataIndex;
                    
                    $("#tooltip").remove();
                    var x = item.datapoint[0].toFixed(0),
                        y = item.datapoint[1].toFixed(2);
	
                    
                    showTooltip(item.pageX, item.pageY,
                                item.series.label + " of " + myMonth[x-1] + " = " +"$"+ y);
                }
            }
            else {
                $("#tooltip").remove();
                previousPoint = null;            
            }       
    });
});
</script>